home *** CD-ROM | disk | FTP | other *** search
/ The PC-SIG Library 9 / The PC-SIG Library on CD ROM - Ninth Edition.iso / 1501_600 / DISK1533 / DISK1533.ZIP / ENTAB.C < prev    next >
Text File  |  1989-02-22  |  752b  |  35 lines

  1. #include <stdio.h>
  2.  
  3. #define    DEFTABS    8    /* default tab stop positions */
  4.  
  5. main(argc, argv)
  6. char *argv[];
  7. int argc;
  8. {
  9.     FILE    *fp;    /* input file pointer    */
  10.     char    *stops;    /* stops on the cmdline  */
  11.     int    tabstop;
  12.     
  13.     argv++;        /* get past command name */
  14.     tabstop = DEFTABS;
  15.  
  16.     if ((stops=getenv("TABS")) != NULL) {
  17.         if ((tabstop = atoi(stops)) <= 0)
  18.             tabstop = DEFTABS;
  19.     }
  20.  
  21.     while (*argv != NULL && **argv == '-') {
  22.         switch ((*argv)[1]) {
  23.             case 't':
  24.                 stops = &(*argv)[2];
  25.                 tabstop = atoi(stops);
  26.                 break;
  27.             default:
  28.                 fprintf(stderr, "%s: unknown option %s\n",
  29.                     "entab", *argv);
  30.         }
  31.         ++argv;    /* Process next argument */
  32.     }
  33.     printf("Using %d tabstop - Default is %d\n", tabstop, DEFTABS);
  34.     return 0;
  35. }